import base from './base';
import services from '@/axios';

const loginAPI = {
  //登录接口
  login(data) {
    return services.post(`${base.test}/user/login`, data)
  },

  //注册接口
  signUp(data) {
    return services.post(`${base.test}/user/register`, data)
  },

  //获取验证码
  getCode(email) {
    return services.get(`${base.test}/user/code`, {params: {email}})
  },

  //获取用户信息
  getUserId(){
    return services.post(`${base.test}/user/me`)
  },

  //修改个人信息
  modifyUser(data){
    return services.put(`${base.test}/user`, data)
  },

  //根据userId获取user信息
  getUserInfo(id){
    return services.get(`${base.test}/user/${id}`)
  },

  //获取userId用户状态
  getState(friendId){
    return services.get(`${base.test}/contacts/online`, {params: {friendId}})
  }
}

export default loginAPI;